Exec

class Exec(dockerClient: DockerClient)

Docker exec operations using the owning DockerClient.

Result-returning methods report daemon HTTP errors as ErrorResponse. Transport/decoding failures and cancellation can throw. Live flows report request failures during collection.

Constructors

Link copied to clipboard
constructor(dockerClient: DockerClient)

Functions

Link copied to clipboard
suspend fun getInfo(id: String): Result<ExecInspectResponse, ErrorResponse>

Inspect an exec instance

Link copied to clipboard
suspend fun resize(id: String, h: Int, w: Int): Result<Unit, ErrorResponse>

Resize an exec instance

Link copied to clipboard
suspend fun startAndForget(id: String, config: ExecStartConfig = ExecStartConfig()): Result<Unit, ErrorResponse>

Starts an existing exec instance using the supplied configuration and discards response output. Set config.detach=true for detached execution; use startInteractive when output is needed. Successful start does not establish the command exit status; inspect it with getInfo.

Link copied to clipboard
suspend fun startInteractive(id: String, consoleSize: Pair<Int, Int>? = null): Result<ExecSession, ErrorResponse>
suspend fun startInteractive(id: String, consoleSize: Pair<Int, Int>? = null, tty: Boolean): Result<ExecSession, ErrorResponse>

Starts a previously created exec instance and returns an independently owned ExecSession. Match the TTY mode used at creation; the overload without tty uses true. Collect one output flow once. Use incomingChunks for terminal bytes and incremental UTF-8 decoding. Close the session when finished, including when output is never collected.